package paa.simulator.heuristic;

import java.util.HashSet;
import java.util.Set;

import paa.simulator.RandomNumberGenerator;
import paa.simulator.grafo.PessoaVertex;
import paa.simulator.grafo.simple.UndirectedSimpleGraph;

public class RandomHeuristic implements Heuristic {

	public int escolheVerticesIniciais(UndirectedSimpleGraph<PessoaVertex> graph, int numberOfVertexes) {
		Set<PessoaVertex> pessoas = graph.vertexSet();

		PessoaVertex[] array = pessoas.toArray(new PessoaVertex[0]);
		Set<Integer> positions = new HashSet<Integer>();

		while(positions.size() < numberOfVertexes) {
			int rand = RandomNumberGenerator.getInstance().nextInt(pessoas.size());
			positions.add(rand);
		}
		
		for (int i : positions) {
			array[i].setAsBuying();
		}
		
		return numberOfVertexes;
	}

	public int refinaEscolha(UndirectedSimpleGraph<PessoaVertex> graph, int numberOfVertex) {
		return 0;
	}
}